package com.yanqu.road.entity.unioncampwar;


import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.DataStatus;
import com.yanqu.road.entity.FieldTypeAnnotation;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 商帮阵营数据
 */
@FieldTypeAnnotation(tableName = "t_c_union_camp_war_camp", autoSave = true)
public class UnionCampWarCampData extends DataObject {

    @FieldTypeAnnotation(desc = "后台分组id", update = true, select = true)
    private int centerGroupId;
    @FieldTypeAnnotation(desc = "分组Id", update = true, select = true)
    private int groupId;
    @FieldTypeAnnotation(desc = "周", update = true, select = true)
    private int weekId;
    @FieldTypeAnnotation(desc = "结束时间")
    private long endTime;
    @FieldTypeAnnotation(desc = "胜利阵营id")
    private int winCampId;
    @FieldTypeAnnotation(desc = "榜单补发标志")
    private int autoSend;
    @FieldTypeAnnotation(desc = "结束时两边的血量")
    private int leftCampHp;
    @FieldTypeAnnotation(desc = "结束时两边的血量")
    private int rightCampHp;
    @FieldTypeAnnotation(desc = "阵营宝库轮次")
    private int leftBoxRound;
    @FieldTypeAnnotation(desc = "阵营宝库本轮大奖")
    private String leftBigReward = "";
    @FieldTypeAnnotation(desc = "阵营宝库本轮大奖位置")
    private int leftBigBoxId;
    @FieldTypeAnnotation(desc = "阵营宝库开奖记录,位置-开奖记录")
    private Map<Integer, UnionCampWarOpenBoxInfo> leftOpenBoxInfoMap = new ConcurrentHashMap<>();
    @FieldTypeAnnotation(desc = "阵营宝库轮次")
    private int rightBoxRound;
    @FieldTypeAnnotation(desc = "阵营宝库本轮大奖")
    private String rightBigReward = "";
    @FieldTypeAnnotation(desc = "阵营宝库本轮大奖位置")
    private int rightBigBoxId;
    @FieldTypeAnnotation(desc = "阵营宝库开奖记录,位置-开奖记录")
    private Map<Integer, UnionCampWarOpenBoxInfo> rightOpenBoxInfoMap = new ConcurrentHashMap<>();
    @FieldTypeAnnotation(desc = "点赞数")
    private List<Integer> worshipList = new ArrayList<>();
    @FieldTypeAnnotation(desc = "进攻路线")
    private Map<Integer, List<Integer>> routeListMap = new HashMap<>();
    @FieldTypeAnnotation(desc = "玩家档位赚钱平均值")
    private List<BigDecimal> avgAbilityList = new ArrayList<>();
    @FieldTypeAnnotation
    private long modifyTime;

    public UnionCampWarCampData(int centerGroupId, int groupId, int weekId) {
        this.centerGroupId = centerGroupId;
        this.groupId = groupId;
        this.weekId = weekId;
        setInsertOption();
    }

    public UnionCampWarCampData() {
    }

    public int getCenterGroupId() {
        return centerGroupId;
    }

    public void setCenterGroupId(int centerGroupId) {
        this.centerGroupId = centerGroupId;
    }

    public int getWeekId() {
        return weekId;
    }

    public void setWeekId(int weekId) {
        this.weekId = weekId;
    }

    public int getGroupId() {
        return groupId;
    }

    public void setGroupId(int groupId) {
        if (this.groupId != groupId) {
            this.groupId = groupId;
            setOp(DataStatus.Update);
        }
    }

    public long getModifyTime() {
        return modifyTime;
    }

    public void setModifyTime(long modifyTime) {
        if (this.modifyTime != modifyTime) {
            this.modifyTime = modifyTime;
            setOp(DataStatus.Update);
        }
    }

    public int getLeftBoxRound() {
        return leftBoxRound;
    }

    public void setLeftBoxRound(int leftBoxRound) {
        if (this.leftBoxRound != leftBoxRound) {
            this.leftBoxRound = leftBoxRound;
            setUpdateOption();
        }
    }

    public int getRightBoxRound() {
        return rightBoxRound;
    }

    public void setRightBoxRound(int rightBoxRound) {
        if (this.rightBoxRound != rightBoxRound) {
            this.rightBoxRound = rightBoxRound;
            setUpdateOption();
        }
    }

    public String getLeftBigReward() {
        return leftBigReward;
    }

    public void setLeftBigReward(String leftBigReward) {
        if (this.leftBigReward != leftBigReward) {
            this.leftBigReward = leftBigReward;
        }
    }

    public int getLeftBigBoxId() {
        return leftBigBoxId;
    }

    public void setLeftBigBoxId(int leftBigBoxId) {
        if (this.leftBigBoxId != leftBigBoxId) {
            this.leftBigBoxId = leftBigBoxId;
            setUpdateOption();
        }
    }

    public String getRightBigReward() {
        return rightBigReward;
    }

    public void setRightBigReward(String rightBigReward) {
        if (this.rightBigReward != rightBigReward) {
            this.rightBigReward = rightBigReward;
        }
    }

    public int getRightBigBoxId() {
        return rightBigBoxId;
    }

    public void setRightBigBoxId(int rightBigBoxId) {
        if (this.rightBigBoxId != rightBigBoxId) {
            this.rightBigBoxId = rightBigBoxId;
        }
    }

    public long getEndTime() {
        return endTime;
    }

    public void setEndTime(long endTime) {
        if (this.endTime != endTime) {
            this.endTime = endTime;
            setUpdateOption();
        }
    }

    public int getWinCampId() {
        return winCampId;
    }

    public void setWinCampId(int winCampId) {
        this.winCampId = winCampId;
        setUpdateOption();
    }

    public int getLeftCampHp() {
        return leftCampHp;
    }

    public void setLeftCampHp(int leftCampHp) {
        this.leftCampHp = leftCampHp;
        setUpdateOption();
    }

    public int getRightCampHp() {
        return rightCampHp;
    }

    public void setRightCampHp(int rightCampHp) {
        this.rightCampHp = rightCampHp;
        setUpdateOption();
    }

    public Map<Integer, UnionCampWarOpenBoxInfo> getLeftOpenBoxInfoMap() {
        return leftOpenBoxInfoMap;
    }

    public void setLeftOpenBoxInfoMap(Map<Integer, UnionCampWarOpenBoxInfo> leftOpenBoxInfoMap) {
        this.leftOpenBoxInfoMap = leftOpenBoxInfoMap;
        setUpdateOption();
    }

    public Map<Integer, UnionCampWarOpenBoxInfo> getRightOpenBoxInfoMap() {
        return rightOpenBoxInfoMap;
    }

    public void setRightOpenBoxInfoMap(Map<Integer, UnionCampWarOpenBoxInfo> rightOpenBoxInfoMap) {
        this.rightOpenBoxInfoMap = rightOpenBoxInfoMap;
        setUpdateOption();
    }

    public void putOpenBoxInfo(int boxId, int campId, UnionCampWarOpenBoxInfo openBoxInfo) {
        if (campId == 1) {
            this.leftOpenBoxInfoMap.put(boxId, openBoxInfo);
        } else {
            this.rightOpenBoxInfoMap.put(boxId, openBoxInfo);
        }
        setUpdateOption();
    }

    public int getAutoSend() {
        return autoSend;
    }

    public void setAutoSend(int autoSend) {
        this.autoSend = autoSend;
        setUpdateOption();
    }

    public List<Integer> getWorshipList() {
        return worshipList;
    }

    public void setWorshipList(List<Integer> worshipList) {
        this.worshipList = worshipList;
    }

    public void addWorship(int campId) {
        for (int i = 0; i < campId; i++) {
            if (this.worshipList.size() <= i) {
                this.worshipList.add(0);
            }
        }
        this.worshipList.set(campId - 1, this.worshipList.get(campId - 1) + 1);

        setUpdateOption();
    }

    public int getWorship(int campId) {
        if (campId <= 0 || campId > this.worshipList.size()) {
            return 0;
        }

        return this.worshipList.get(campId - 1);
    }

    public Map<Integer, List<Integer>> getRouteListMap() {
        return routeListMap;
    }

    public void setRouteListMap(Map<Integer, List<Integer>> routeListMap) {
        this.routeListMap = routeListMap;
        setUpdateOption();
    }

    public List<BigDecimal> getAvgAbilityList() {
        return avgAbilityList;
    }

    public void setAvgAbilityList(List<BigDecimal> avgAbilityList) {
        this.avgAbilityList = avgAbilityList;
        setUpdateOption();
    }
}
